package com.example.blog.repository;

import com.example.blog.entity.SystemLog;
import com.example.blog.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;

@Repository
public interface SystemLogRepository extends JpaRepository<SystemLog, Long>, JpaSpecificationExecutor<SystemLog> {
    Page<SystemLog> findByType(String type, Pageable pageable);
    Page<SystemLog> findByLevel(String level, Pageable pageable);
    Page<SystemLog> findByModule(String module, Pageable pageable);
    Page<SystemLog> findByUser(User user, Pageable pageable);
    Page<SystemLog> findByCreatedAtBetween(LocalDateTime start, LocalDateTime end, Pageable pageable);
    void deleteByCreatedAtBefore(LocalDateTime date);
} 